package com.xuecheng.exception;

/**
 * 学成在线项目异常类   --自定义异常类
 */
public class XuechengOnlineException extends RuntimeException{

    private String errMessage;
    private String errCode;

    public XuechengOnlineException(String errMessage) {
        super(errMessage);
        this.errMessage = errMessage;
    }

    public XuechengOnlineException() {
        super();
    }

    public String getErrMessage() {
        return errMessage;
    }

    public XuechengOnlineException(String errMessage, String errCode) {
        this.errMessage = errMessage;
        this.errCode = errCode;
    }

    public String getErrCode() {
        return errCode;
    }

    public static void cast(CommonError commonError){
        throw new XuechengOnlineException(commonError.getErrMessage());
    }

    public static void cast(String errMessage){
        throw new XuechengOnlineException(errMessage);
    }
}
